﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GuiClient.DTO;

namespace GuiClient
{
    public partial class UserControlManHinhChonChucNang : UserControl
    {
        private TaiKhoanDTO thongTinTaiKhoan;

        public delegate void RutTien();
        public event RutTien RutTienEvent;

        public delegate void Thoat();
        public event Thoat ThoatEvent;

        public delegate void ChuyenKhoan();
        public event ChuyenKhoan ChuyenKhoanEvent;

        public TaiKhoanDTO ThongTinTaiKhoan
        {
            get { return thongTinTaiKhoan; }
            set { thongTinTaiKhoan = value; }
        }

        public UserControlManHinhChonChucNang()
        {
            InitializeComponent();
        }

        private void buttonRutTien_Click(object sender, EventArgs e)
        {
            if (RutTienEvent != null)
            {
                RutTienEvent();
            }
        }

        private void UserControlManHinhChonChucNang_Load(object sender, EventArgs e)
        {

        }

        private void buttonChuyenKhoan_Click(object sender, EventArgs e)
        {
            if (ChuyenKhoanEvent != null)
            {
                ChuyenKhoanEvent();
            }
        }

        private void buttonThoat_Click(object sender, EventArgs e)
        {
            if (ThoatEvent != null)
            {
                ThoatEvent();
            }
        }

        public void UpdateGiaoDienThongTinTaiKhoan(TaiKhoanDTO taiKhoanInfo)
        {
            this.thongTinTaiKhoan = taiKhoanInfo;
            this.labelTenChuThe.Text = this.thongTinTaiKhoan.HoTen.ToUpper();
            this.labelMaThe.Text = this.thongTinTaiKhoan.MaThe;
            this.labelNgayHetHan.Text = this.thongTinTaiKhoan.NgayHetHan.ToShortDateString();
            this.labelSoDu.Text = this.thongTinTaiKhoan.SoDu.ToString();
        }
    }
}
